<template>
	<u-popup :show="isShow" mode="bottom" border-radius='20' @close='close' closeable>
		<view class="content">
			<view class="header">
				<image :src="itemModel.coverUrl" mode="" style="width: 160rpx;height: 160rpx;"></image>
				<view class="right">
					<jc-price :value='itemModel.price' valueSize='34'></jc-price>
					<view style="margin-top: 10rpx;color: #999;font-size: 26rpx;">建议零售价：¥{{itemModel.sellingPrice}}</view>
					<text>库存 {{itemModel.stock}}</text>
					<text v-if="itemModel.specs_sel" style="margin-top: 10rpx;">已选择  {{itemModel.specs_sel}}</text>
				</view>
			</view>
			<scroll-view class="item_cont" :scroll-y="true">
				<sku-content ref="skuContent" @click='skuSpecClick' :specList='itemModel.specList'></sku-content>
				<view style='display: flex;flex-direction: row;justify-content: space-between;margin-top: 20rpx;padding-bottom: 80rpx;padding-top: 30rpx;'>
					<view style="color: #333333;font-weight: bold;">数量</view>
					<!-- <wm-numberBox model="1" height='28' :min='itemModel.minShopCount' :max='1000' @change="payCountChange" :value='payCount'></wm-numberBox> -->
					<uni-number-box v-model="payCount" :min="1" :max="itemModel.stock" @change="payCountChange"></uni-number-box>
				</view>
			</scroll-view>
			<view class="footer">
				<jc-button :width='600' @click='confirm' backgroundColor='#FC5E53' :circle='true' title="立即加入进货单"></jc-button>
			</view>
		</view>
	</u-popup>
</template>

<script>
	import skuContent from './sku_content.vue'
	import wmNumberBox from "@/components/wm-numberBox/wm-number-box.vue"
	export default{
		components:{skuContent, wmNumberBox},
		props:{
			itemModel: {
				type: Object,
				default: ()=>{}
			},
		},
		data() {
			return {
				isShow: false,
				confirmStyle:{
					backgroundColor: '#059595'
				},
				payCount: 1
			}
		},
		methods:{
			show(){
				this.isShow = true
			},
			close(){
				this.isShow = false
				this.$emit('close')
			},
			open(){
				this.$emit('open')
			},
			skuSpecClick(spec, index, index2){
				this.$emit('skuSpecClick', spec, index, index2)
			},
			payCountChange(e){
				console.log('e', e)
				this.payCount = e.value
			},
			confirm(){
				this.$emit('confirm', this.payCount)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		display: flex;
		flex-direction: column;
		background-color: #FFFFFF;
		padding: 30rpx;
		.header{
			display: flex;
			flex-direction: row;
			padding-bottom: 20rpx;
			.right{
				display: flex;
				flex-direction: column;
				margin-left: 20rpx;
				justify-content: flex-end;
				text{
					font-size: 28rpx;
				}
			}
		}
		.item_cont{
			min-height: 600rpx;
			max-height: 1000rpx;
		}
		.footer{
			display: flex;
			flex-direction: column;
			align-items: center;
		}
	}
</style>
